import time
import time
import socket
def ExecTime(orignal_func):
    def wrapper(*args,**kwargs):
        start=time.time_ns()
        if args:#不是None
           print(args)
        if kwargs:
           print(kwargs)
        result=orignal_func(*args,**kwargs)
        end = time.time_ns()
        print(orignal_func,"执行耗时",(end-start),"纳秒",sep="")
        return result
    return wrapper#返回了一个函数
@ExecTime
def mul(a,*b):
    sum=0
    for x in range(1000):
        for i in b:
            sum+=a**i
    return sum

@ExecTime
def getsocket(dizhi:str,port:int):
    try:
        s=socket.socket()
        print("信息准备发送")
        #s.connect("localhost",9000)
        s.connect(dizhi,port)
        s.sendall("hello,socket".encode())
        print("信息发送完成")
    except :
        pass

if __name__ == '__main__':
    total=mul(5,2,3,4,5,6)
    print(f"total={total}")
    getsocket("www.baidu.com",9999)